<?php
class Customer_Form_Orders extends TBB_Form
{
	public function init()
	{
		$this->addAttribs(array(
			'class' => 'span-6',
		));
		
		// create order element		
		$order = $this->_createOrderElement();
		
		// create submit element
		$submit = $this->_createSubmitElement();
		
		$this->addElements(array($order, $submit));
		$this->addDisplayGroup(array('order', 'submit'), 'cancelOrderGroup');
		
		$this->setDecorators($this->_formDecorators);
		$this->setDisplayGroupDecorators($this->_displayGroupDecorators);
		
		// override fieldset class
		$this->getDisplayGroup('cancelOrderGroup')->setAttrib('class', 'fieldsetFormNav');
	}
	
	private function _createOrderElement()
	{
		$order = $this->createElement('text', 'order')
					  ->setLabel('Mã đơn hàng: ')
					  ->setRequired(true)
					  ->addFilter('StripTags')
					  ->addErrorMessage('Làm ơn nhập mã đơn hàng.');
		$order->setAttribs(array(
			'class' => 'span-4'
		));
		$order->getDecorator('Label')->setOption('class', 'span-3 labelDecorator');
		$order->getDecorator('Errors')->setOption('class', 'span-4 errorDecorator');
		return $order;
	}
	
	private function _createSubmitElement()
	{
		$submit = $this->createElement('submit', 'submit')	
					   ->setLabel('Hủy vé')
					   ->setDecorators($this->_submitDecorators);
		$submit->setAttribs(array(
			'class' => 'span-3 submitDecorator'
		));
		return $submit;
	}
}